package com.ktwlsoft.archivemanage.service.utils;

/**
 * 用户工具类
 *
 * @author zhuhe on 2019/10/25 11:06
 * @version 1.0
 */
public class UserUtils {

    /**
      * 检测密码强度(0:弱,1:中,2:强) on 2019/10/25 11:08
      *
      * @param passWord passWord
      * @return Integer
      */
    public static Integer testingPasswordStrength(String passWord){
        if(passWord.length() <= 0){
            return 0;
        }
        int i = 0;
        if(StringUtil.isDigit(passWord)){
            i += 1;
        }
        if(StringUtil.isLetter(passWord)){
            i += 1;
        }
        if(StringUtil.isSpecialCharacters(passWord)){
            i += 1;
        }
        if(passWord.length() > 8){
            i += 1;
        }
        int result = 0;
        if(i >= 2 && i < 4){
            result = 1;
        }else if(i >= 4){
            result = 2;
        }
        return result;
    }
}